import request from '@/utils/request'

// 获取文章列表
export function getArticleList(params) {
  return request({
    url: '/api/admin/article/list',
    method: 'get',
    params
  })
}

// 新增文章
export function addArticle(data) {
  return request({
    url: '/api/admin/article',
    method: 'post',
    data
  })
}

// 编辑文章
export function editArticle(id, data) {
  return request({
    url: `/api/admin/article/${id}`,
    method: 'put',
    data
  })
}

// 删除文章
export function deleteArticle(id) {
  return request({
    url: `/api/admin/article/${id}`,
    method: 'delete'
  })
}

// 获取文章详情
export function getArticleDetail(id) {
  return request({
    url: `/api/admin/article/${id}`,
    method: 'get'
  })
}

// 审核文章
export function auditArticle(id, data) {
  return request({
    url: `/api/admin/article/${id}/audit`,
    method: 'post',
    data
  })
}

// 上传图片（示例，需后端支持）
export function uploadArticleImage(formData) {
  return request({
    url: '/api/admin/article/upload',
    method: 'post',
    data: formData,
    headers: { 'Content-Type': 'multipart/form-data' }
  })
} 